﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Plat.WfProcess.Common;
using Plat.WfProcess.Business;
using Plat.WfProcess.DataModel;
using Plat.WfProcess.Utility;

namespace Plat.WfProcess.Engine
{
    /// <summary>
    /// 任务节点
    /// </summary>
    internal class TaskNode : WorkItem
    {
        internal TaskNode(ActivityEntity activity)
            : base(activity)
        {

        }

        internal override void CreateNewTask(ActivityResource activityResource,
            ProcessModelDataContext wfLinqDataContext)
        {
            TaskManager taskManager = new TaskManager();
            taskManager.Insert(base.ActivityInstance,
                activityResource.NextActivityPerformers[base.Activity.ActivityGUID],
                wfLinqDataContext);
        }

        internal override void CompleteTask(long taskID,
            ActivityResource activityResource,
            ProcessModelDataContext wfLinqDataContext)
        {
            TaskManager tm = new TaskManager();
            tm.Complete(taskID,
                activityResource.CurrentLogonUser,
                wfLinqDataContext);
        }
    }
}
